<head> 
    <style>
        input {
            border:#474747 1px solid;
            background:#2f2f2f;
            font-size:12px;
            font-family:Arial, Helvetica, sans-serif;
            color:#fff;
            padding:4px 10px 5px 10px;
            outline: medium none;
            width:256px;
            height:17px;
            float:left;
        }
        .btns {
            width:156px;
            text-align:right;
            overflow:hidden;
            border-top:#2e2e2e 1px solid;
            margin-left:200px;
            margin-top:14px;
            padding-top:10px;
        }
        .input2{    
            height:28px;
            width: 156px;
        }
        textarea {
            border:#474747 1px solid;
            background:#2f2f2f;
            font-size:12px;
            font-family:Arial, Helvetica, sans-serif;
            color:#fff;
            height:122px;
            outline: medium none;
            overflow: auto;
            padding: 4px 0px 0px 10px;
            width: 546px;
            resize:none;
            margin:0px 0 0 0;
            float:left;
            margin-bottom: 10px;
        }
    </style>
</head>

<div class="grid_2 prefix_1"><br></div>
<div class="grid_16 prefix_1">
    <h2 class="h2 top-3">Inscripción de actividad</h2><br><br>
    <?php foreach ($sql as $row): ?>
        <?php $query = $this->db->get_where('usersactivities', array('id' => $row['id'], 'dni' => $dni));
				if($query->num_rows()==1 && $row['price']==0) {
					echo form_open('activity/deregister');
				}else{		
					echo form_open('activity/register'); 
				}?>
        <h3 class="titulo">Nombre de Actividad: <?php echo $row['name']; ?></h3>
        <label>Lugar: <?php echo $row['place']; ?></label><br>
        <label>Fecha: <?php echo $row['datee']; ?></label><br>
        <label>Hora: <?php echo $row['timee']; ?></label><br>
        <label>Precio: <?php echo $row['price']; ?></label><br>
        <label>Plazas disponibles: <?php echo $row['available']; ?></label><br>
		<input type="hidden" name="id" id="id" value="<?php echo $row['id']; ?>">
        <br>
        <textarea readonly><?php echo $row['description']; ?></textarea>
		
		<div class="btns"><?php //¿Está inscrito?
								$query = $this->db->get_where('usersactivities', array('id' => $row['id'], 'dni' => $dni));
								if($query->num_rows()==0) {
									echo '<input class="input2" type="submit" value="Inscribirse" >';
								}elseif($row['price']==0){
									echo '<input class="input2" type="submit" value="Desinscribirse" >';
								}else{
									echo '<input class="input2" type="" value="Inscrito" >';
								}
        ?></div>
		
    </form>
    <br><br>
<?php endforeach; ?>
</div>
<div class="clear"></div>
